<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<script type="text/javascript" src="<%=basePath %>jquery/jquery-1.7.2.min.js"></script>
  </head>
  
  <body>
  ajax提交:<br/>
  <input type="text" id="v1" size=3/>
  +
  <input type="text" id="v2" size=3/>
  =
  <input type="button" value="JSON" onclick="getResult();"/>
  <input type="button" value="String" onclick="getResult1();"/>
  
  
  <script type="text/javascript">
  var basePath = '<%=basePath%>';
  function getResult(){
	  $.ajax({
		  url : basePath+'ajax/getJsonValue',
		  type : 'GET',
		  dataType : 'json',
		  data : {
			  'v1' : $('#v1').val(),
			  'v2' : $('#v2').val()
		  },
		  success : function(r){
			  alert(JSON.stringify(r));
		  }
	  });
  }

  function getResult1(){
	  $.ajax({
		  url : basePath+'ajax/getValue',
		  type : 'GET',
		  dataType : 'json',
		  data : {
			  'v1' : $('#v1').val(),
			  'v2' : $('#v2').val()
		  },
		  success : function(r){
			  alert(r);
		  }
	  });
  }

  </script>
</html>
